# frozen_string_literal: true
class JpushServiceJob < ApplicationJob
  queue_as :jpush_service

  def perform(interview_id,registration_id, extras, content)
    if interview_id.nil?
        JpushService.new(registration_id, extras, content).invoke
    else
      push_service_id(interview_id,registration_id, extras, content)
    end
  end

  def push_service_id(id,registration_id, extras, content)
    @interview = Interview.find(id)
    exited_at = @interview.exited_at
    if exited_at.nil?
      JpushService.new(registration_id, extras, content).invoke
    end
  end
end
